<?php 
/**
	Class used to identify a user
*/
Class login
{
	function signIn($email, $password)
	{
		$password = md5($password);
		$db = new connexionDB();
		$result = $db->getDataFromAccount();
		
		foreach ($result as $row)
		{
			if ($email == $row['email'] && $password == $row['password'])
			{
				$session 					= session::getInstance();
				$session->firstname			= $row['firstname'];
				$session->lastname 			= $row['lastname'];
				$session->id_accountType 	= $row['id_account_type'];
				$session->name_accountType 	= $db->getNameAccountType($session->id_accountType);
				$session->team 				= $row['team'];
				$session->id_account 		= $row['id'];
				$session->lang 				= 'FR';
				return true;
			}
		}
		return false;
	}
}

?>